/* 
 * File:   message.h
 * Author: james
 *
 * Created on 2011年3月31日, 下午12:58
 */

#ifndef MESSAGE_H
#define	MESSAGE_H

#include "sys_def.h"
#include <string>

#include "command.h"

namespace edm
{
    namespace network
    {
        #define MESG_HDR_MAGIC 0xA5

        #define MESSAGE_HDR_MAX_LEN 16        
        
        #define MYNET     "MYNET"
        
#pragma pack(1)
        struct message_header_t
        {
            message_header_t():
            magic(0xA5),compress(0),command(0),len(0),reserve(0)
            {
            }
            edm_uint8_t         magic;
            edm_uint8_t         compress;
            edm_uint8_t         command;
            edm_uint32_t        len;
            edm_uint64_t        reserve;    
        };
#pragma pack()
        
        typedef edm_uint8_t     message_header_command_t;
        typedef edm_uint64_t    message_header_reserve_t;
        
        struct message_t
        {
            message_header_t    header;
            std::string         body;
        };

    }
}



#endif	/* MESSAGE_H */

